<div class="groups view">
<h2><?php  echo __('Grupo'); ?></h2>
	<dl>
		<dt><?php echo __('Id'); ?></dt>
		<dd>
			<?php echo h($group['Group']['id']); ?>
			&nbsp;
		</dd>
		<dt><?php echo __('Name'); ?></dt>
		<dd>
			<?php echo h($group['Group']['name']); ?>
			&nbsp;
		</dd>
		<dt><?php echo __('Institution'); ?></dt>
		<dd>
			<?php echo $this->Html->link($group['Institution']['nombre'], array('controller' => 'institutions', 'action' => 'view', $group['Institution']['id'])); ?>
			&nbsp;
		</dd>
	</dl>
</div>
<div class="actions">
	<h3><?php echo __('Actions'); ?></h3>
	<ul>
		<li><?php echo $this->Html->link(__('Editar grupo'), array('action' => 'edit', $group['Group']['id'])); ?> </li>
		<!--li><?php echo $this->Form->postLink(__('Borrar grupo'), array('action' => 'delete', $group['Group']['id']), null, __('Are you sure you want to delete # %s?', $group['Group']['id'])); ?> </li>
		<li><?php echo $this->Html->link(__('Listar grupos'), array('action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('Nuevo grupo'), array('action' => 'add')); ?> </li-->
		<li><?php echo $this->Html->link(__('Listar instituciones'), array('controller' => 'institutions', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('Nueva institución'), array('controller' => 'institutions', 'action' => 'add')); ?> </li>
		<!--li><?php echo $this->Html->link(__('Listar grupos de alumnos'), array('controller' => 'group_users', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('Nuevo grupo de alumnos'), array('controller' => 'group_users', 'action' => 'add')); ?> </li-->
	</ul>
</div>
<div class="related">
	<h3><?php echo __('Alumnos en el grupo'); ?></h3>
	<?php if (!empty($group['User'])): ?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php echo __('Nombre'); ?></th>
		<!--th><?php echo __('Group Id'); ?></th>
		<th><?php echo __('User Id'); ?></th-->
		<th><?php echo __('Lider'); ?></th>
		<th class="actions"><?php echo __('Acciones'); ?></th>
	</tr>
	<?php
		$i = 0;
		//print_r($group);
		foreach ($group['User'] as $user): ?>
		<tr>
			<td><?php echo $user['nombres']." ".$user['apellido_paterno']." ".$user['apellido_materno']; ?></td>
			<!--td><?php echo $groupUser['GroupUser']['group_id']; ?></td>
			<td><?php echo $groupUser['GroupUser']['user_id']; ?></td>
			<td><?php echo $groupUser['GroupUser']['lider']; ?></td-->
			<td><?php  if($user['GroupUser']['lider'])echo "Lider";else echo "------"; ?></td>
			<td class="actions">
				<?php echo $this->Html->link(__('Ver'), array('controller' => 'group_users', 'action' => 'view', $user['GroupUser']['id'])); ?>
				<?php echo $this->Html->link(__('Editar'), array('controller' => 'group_users', 'action' => 'edit', $user['GroupUser']['id'])); ?>
				<?php echo $this->Form->postLink(__('Eliminar del grupo'), array('controller' => 'group_users', 'action' => 'delete', $user['GroupUser']['id'],$user['GroupUser']['group_id'],$user['GroupUser']['lider']), null, __('Estas seguro de eliminar el alumno %s?', $user['nombres']." ".$user['apellido_paterno']." ".$user['apellido_materno']." del grupo")); ?>
				<?php echo $this->Form->postLink(__('Cambiar Lider'), array('action' => 'changeLider', $user['GroupUser']['group_id'],$user['GroupUser']['user_id']), null, __('Estas seguro que quieres poner de lider a %s?', $user['nombres']." ".$user['apellido_paterno']." ".$user['apellido_materno'])); ?>
				
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $this->Form->postLink(__('Agregar alumno al grupo'), array('action' => 'addStudent',$group['Group']['id'],$group['Group']['institution_id'])); ?> </li>
		</ul>
	</div>
</div>
